package com.mioto.ld.communication.mqtt.protocol.model.server;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.mioto.ld.communication.mqtt.protocol.model.Payload;
import lombok.Getter;
import lombok.Setter;

/**
 * @author mioto-qinxj
 * @date 2024/5/7
 * @desc 属性设置
 */
@Getter
@Setter
public class AttributeSetPayload extends Payload {

    /**
     * 属性设置类型
     */
    private String ptype;

    /**
     * 属性值
     */
    private JsonObject attribute;

    public JsonElement toJson(){
        JsonObject jsonObject = attribute.deepCopy();
        jsonObject.addProperty("ptype",ptype);
        return jsonObject;
    }
}
